<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <script>

        //千位分割符
        function sortString(num) {
            num = num + '';
            var str = "";
            for (var i = num.length - 1, j = 1; i >= 0; i--, j++) {
                if (j % 3 == 0 && i != 0) {
                    str += num[i] + ",";
                    continue;
                }
                str += num[i];
            }
            return str.split('').reverse().join("");
        }





        //排序
        function sortNumber(a, b) {
            return a - b
        }

        var arr = new Array(6)
        arr[0] = "10"
        arr[1] = "5"
        arr[2] = "40"
        arr[3] = "25"
        arr[4] = "1000"
        arr[5] = "1"

        document.write(arr + "<br />")
        document.write(arr.sort(sortNumber))
    </script>
</body>

</html>